* Set Directory
clear
set more off

cd "$path"
global working_data "$path/data"
global out_files "$path/output"

********************************************************************************
* Falsification test
********************************************************************************
// use "$working_data/sample1.dta", clear
//
// frame create sim1 mean var
// frame create sim2 mean var
//
// forvalues i=1/1000 {
//
//     qui shufflevar group_eray_never, joint
// 	qui jwdid depression if ragey<63 & ragender==1 & c_lms_new==3, ivar(nmergeid) tvar(ragey) gvar(group_*_shuffled) never fevar(riwm)
// 	qui estat simple, post
// 	qui frame post sim1 (_b[simple]) (_se[simple])
// 	qui jwdid reurod if ragey<63 & ragender==1 & c_lms_new==3, ivar(nmergeid) tvar(ragey) gvar(group_*_shuffled) never fevar(riwm)
// 	qui estat simple, post
// 	qui frame post sim2 (_b[simple]) (_se[simple])
// 	qui drop group_eray_never_shuffled
//	
// }
//
// frame sim1: save "$working_data/sim1.dta", replace
// frame sim2: save "$working_data/sim2.dta", replace

********************************************************************************
* Plot
********************************************************************************
use "$working_data/sim1.dta", clear
// gen tstdcount = mean/var
*t -3.28
hist tstdcount, xline(-3.28, lc(cranberry)) ysc(r(0 0.5)) ylab(0(0.1)0.5) xsc(r(-10 10)) xlab(-10(5)10) xtitle("t-stat") width(0.5) text(0.48 -0 "p = .001") scale(1.3)
graph export "$out_files/falsDepression.pdf", replace

use "$working_data/sim2.dta", clear
// gen tstdcount = mean/var
*t -2.06
hist tstdcount, xline(-2.06, lc(cranberry)) ysc(r(0 0.5)) ylab(0(0.1)0.5) xsc(r(-10 10)) xlab(-10(5)10) xtitle("t-stat") width(0.5) text(0.48 -0 "p = .023") scale(1.3)
graph export "$out_files/falsEurod.pdf", replace



